#include "stdafx.h"
#include "Signal.h"

namespace Core
{
	void CSignalHandler(int p_SignalNumber)
	{
		if (Signal::GetSingleton().GetHandler()!=NULL) Signal::GetSingleton().GetHandler()->Handler(p_SignalNumber);
		Signal::GetSingleton().RegisterSignal(p_SignalNumber);
	}

	Signal::Signal()
	{
		m_Handler = NULL;
	}

	SignalHandler* Signal::GetHandler()
	{
		return m_Handler;
	}

	void Signal::SetHandler(SignalHandler* p_Handler)
	{
		m_Handler = p_Handler;
	}

	void Signal::RegisterSignal(int p_SignalNumber)
	{
#ifndef WIN32
		signal(p_SignalNumber, CSignalHandler);
#endif
	}
}
